home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Agent Central Host Computer
/
Agent - Central Host Computer.iso
/
_SETUP.1
/
vcurstaterange.sql
< prev
next >
Wrap
Text File
|
2000-05-12
|
2KB
|
49 lines
/*
This view examines curstate and creates a view that has beginning and ending sequence numbers for sections of the curstate data.
The first part sets range for begin of probe to first flagged curstate record (i.e., reporting flag = 1).
The second part sets ranges of all the other successive pairs of curstate records with reporting flag = 1.
*/
CREATE OR REPLACE VIEW vcurstaterange AS
/*mod 5/2/00 */
SELECT CONVERT.conversion_num,
CONVERT.farebox_glid,
CONVERT.beg_det_seq open_count,
CURSTATE.det_seq_num close_count,
CURSTATE.current_cashbox_id,
CASHBOX.cashbox_glid,
CURSTATE.conv_DATE
FROM CONVERT, CURSTATE, CASHBOX
WHERE
/* CONVERT.conversion_num = 848 AND */
CURSTATE.reporting_flag = 1 AND
CURSTATE.current_cashbox_id = CASHBOX.cb_sernum AND
CURSTATE.det_seq_num =
(SELECT MIN(curstate1.det_seq_num)
FROM CURSTATE curstate1
WHERE curstate1.reporting_flag = 1 AND
curstate1.det_seq_num BETWEEN
CONVERT.BEG_DET_SEQ AND CONVERT.end_det_seq)
UNION
SELECT CONVERT.conversion_num,
CONVERT.farebox_glid,
curstate1.det_seq_num open_count,
curstate2.det_seq_num close_count,
curstate2.current_cashbox_id,
CASHBOX.cashbox_glid,
curstate1.conv_DATE
FROM CONVERT, CURSTATE curstate1, CURSTATE curstate2, CASHBOX
WHERE
/* CONVERT.conversion_num = 848 AND */
curstate1.reporting_flag = 1 AND
curstate1.det_seq_num BETWEEN
CONVERT.beg_det_seq AND CONVERT.end_det_seq AND
curstate2.reporting_flag = 1 AND
curstate2.current_cashbox_id = CASHBOX.cb_sernum AND
curstate2.det_seq_num =
(SELECT MIN(curstate3.det_seq_num)
FROM CURSTATE curstate3
WHERE curstate3.reporting_flag = 1 AND
curstate3.det_seq_num > CURSTATE1.det_seq_num AND
curstate3.det_seq_num <= CONVERT.end_det_seq );